<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
    <title>我配送的商品</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
							
    <section class="content-header">
        <h1>我配送的商品</h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">配送关系</a></li>
            <li class="active"><a href="#">我配送的商品</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            <div class="input">
            	<div class="textalign1">通用名：</div>
                <div class="boxinput">
                    <input class="textinput" type="text" id="drugName" id="drugName" placeholder="通用名" />
                </div>
            	<div class="textalign1">药品编码：</div>
            	<div class="boxinput">
            		<input class="textinput" type="text" id="drugCode" name="drugCode" placeholder="药品编码" ></input>
            	</div>
            	<div class="textalign1">生产企业：</div>
                <div class="boxinput">
                    <input class="textinput" type="text" id="compName" name="compName" placeholder="生产企业" />
                </div>
                <div class="textalign1">
                    <button type="button" class="btn btn-success btn-sm" onclick="search();" id="selectc">查 询</button>
                </div>
            </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
       
    </section>
	<%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
    	
	    //绑定回车
		$('#goodsCode,#drugCode,#drugName,#compName').bind('keydown', function(event) {
		    if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
		        $('#selectc').click();
		    }
		}); 
		
		$("#drugName").focus();//加载页面光标在第一个查询框上

    	function search(page) {
    		var goodsCode = $.trim($("#goodsCode").val());
    		var drugCode = $.trim($("#drugCode").val());
    		var drugName = $.trim($("#drugName").val());
    		var compName = $.trim($("#compName").val());
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{"goodsCode":goodsCode, "drugCode":drugCode, "drugName":drugName, "compName":compName},
    	        page : (page || 1)
    	    }).trigger("reloadGrid"); //重新载入  
    	}
    	
    	function drugByPSArea(goodsCode) {
    		window.location.href = "${ctx}/baseDel/toDrugByPSArea.html?goodsCode="+goodsCode;
    	}
    	
        $(function () {
            $("#gridlist").jqGrid({
                url: "getDrugByPS.html",
                mtype: "post",
                datatype: "json",
                autowidth: true,
                shrinkToFit:true,
             //   height: 320,
                colNames: [
					'操作',
					'采购限价',
					'商品编码',
					'药品编码',
					'通用名',
					'剂型',
					'规格',
					'转换系数',
					'单位', 
					'材质',
					'生产企业', 
					'配送区域数'
					
                ],
                colModel: [
					{ name: 'operate', width: 60, align:"center", sortable: false,
						formatter : function(val, opts, rowdata) {
					    	var str = "<a href='javascript:drugByPSArea(\""+rowdata.goodsCode+"\");' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -140px -60px' class='opIcon' title='查看配送区域'></a>";
					    	return str;
					}},
					{ name:'proPriceLimit',index:'proPriceLimit', width:80, align:"right", sortable:false,
                        formatter:function(cellvalue, options, row){ 
                        return formatAmount(cellvalue, options, row);
                        }
                    },
                    { name: 'goodsCode', width: 100, align:"center",hidden:true, sortable: false},
                    { name: 'drugCode', width: 100, align:"center", sortable: false},
                    { name: 'drugName', width: 160, align:"left", sortable: false},
                    { name: 'formName', width: 80, align:"center", sortable: false},
                    { name: 'specName', width: 80, align:"left", sortable: false},
                    { name: 'factor', width: 80, align:"center", sortable: false},
                    { name: 'unit', width: 40, align:"center", sortable: false},
                    { name: 'materialName', width: 80, align:"center", sortable: false},
                    
                    { name: 'compName', width: 280, align:"left", sortable: false},
                    
                    { name: 'count', width: 80, align:"center", sortable: false}
                    
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: false, 
                viewrecords: true,
                caption: "我配送的商品列表",
                jsonReader: {
                	repeatitems: false,
                    id: ""
                },
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight", create());
        });
    </script>
</body>
</html>
